home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / daemons / ipServer / RCS / ipServer.h,v < prev    next >
Encoding:
Text File  |  1991-12-06  |  7.0 KB  |  309 lines

  1. head     1.7;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.7
  10. date     89.08.15.19.55.32;  author rab;  state Exp;
  11. branches ;
  12. next     1.6;
  13.  
  14. 1.6
  15. date     89.04.10.16.22.28;  author brent;  state Exp;
  16. branches ;
  17. next     1.5;
  18.  
  19. 1.5
  20. date     89.03.23.09.08.24;  author brent;  state Exp;
  21. branches ;
  22. next     1.4;
  23.  
  24. 1.4
  25. date     89.02.21.10.06.07;  author brent;  state Exp;
  26. branches ;
  27. next     1.3;
  28.  
  29. 1.3
  30. date     88.08.26.16.34.59;  author mendel;  state Exp;
  31. branches ;
  32. next     1.2;
  33.  
  34. 1.2
  35. date     88.08.16.11.16.23;  author mendel;  state Exp;
  36. branches ;
  37. next     1.1;
  38.  
  39. 1.1
  40. date     88.04.27.09.01.18;  author brent;  state Exp;
  41. branches ;
  42. next     ;
  43.  
  44.  
  45. desc
  46. @Top level defs
  47. @
  48.  
  49.  
  50. 1.7
  51. log
  52. @Commented #endif labels.
  53. @
  54. text
  55. @/*
  56.  * ipServer.h --
  57.  *
  58.  *    Global declarations of the Internet protocol server process.
  59.  *
  60.  * Copyright 1987 Regents of the University of California
  61.  * All rights reserved.
  62.  * Permission to use, copy, modify, and distribute this
  63.  * software and its documentation for any purpose and without
  64.  * fee is hereby granted, provided that the above copyright
  65.  * notice appear in all copies.  The University of California
  66.  * makes no representations about the suitability of this
  67.  * software for any purpose.  It is provided "as is" without
  68.  * express or implied warranty.
  69.  *
  70.  * $Header: /sprite/src/daemons/ipServer/RCS/ipServer.h,v 1.6 89/04/10 16:22:28 brent Exp Locker: rab $ SPRITE (Berkeley)
  71.  */
  72.  
  73. #ifndef _IPS_IPSERVER
  74. #define _IPS_IPSERVER
  75.  
  76. #include "sprite.h"
  77. #include "status.h"
  78. #include "stdlib.h"
  79. #include "net.h"
  80. #ifndef KERNEL
  81. /*
  82.  * We can only use the regular C library stdio in the user-level ipServer.
  83.  * The kernel has its own printf routines.
  84.  */
  85. #include <stdio.h>
  86. #else
  87. #define stderr    0
  88. #define stdout 0
  89. typedef int FILE;
  90. #endif
  91.  
  92. /* macros and constants */
  93.  
  94. #define MIN(a, b)    ((a) < (b) ? (a) : (b))
  95. #define MAX(a, b)    ((a) > (b) ? (a) : (b))
  96.  
  97. /*
  98.  * Internal representations of the protocol numbers.
  99.  * The protocol numbers in netInet.h are not contiguous and too spread
  100.  * out to be useful. If you add a protocol here, be sure to update
  101.  * the Sock_Init routine in sockOps.c.
  102.  */
  103. #define RAW_PROTO_INDEX        0
  104. #define UDP_PROTO_INDEX        1
  105. #define TCP_PROTO_INDEX        2
  106. #define MAX_PROTO_INDEX        TCP_PROTO_INDEX
  107.  
  108.  
  109. /* data structures */
  110.  
  111.  
  112. /*
  113.  * The IPS_Packet structure describes the format of a memory buffer that
  114.  * holds an incoming or outgoing packet. Every packet has an network header,
  115.  * an IP header, possibly a header for a higher-level protocol, and data.
  116.  * For an incoming packet, the headers begin at the base address of the
  117.  * buffer. For an outgoing packet, the headers are added "bottom-up" so
  118.  * there might be a gap of unused memory between the base and the network
  119.  * header. The routine that allocates an outgoing packet must reserve enough
  120.  * space to insert all the headers.
  121.  *
  122.  * The network header is not touched by the protocol routines. Only the
  123.  * I/O routine is allowed to manipulate it.
  124.  */
  125.  
  126. typedef struct {
  127.     int            totalLen;    /* Total length (in bytes) of the
  128.                      * buffer. */
  129.     Address        base;        /* Base address returned by Mem_Alloc.
  130.                      * This is the address that is given
  131.                      * to Mem_Free to release the buffer. */
  132.     Address        dbase;        /* Base address of data in buffer. */
  133.     /*
  134.      * The following pointers point to addresses within the buffer that
  135.      * starts at base and ends at (base + totalLen - 1).
  136.      */
  137.  
  138.     union {
  139.     Net_EtherHdr    *etherPtr;    /* Ptr. to the ethernet header. */
  140.     /*
  141.      * Ptrs to headers for other network types go here.
  142.      *   NOTE: If you add a field here, add a corresponding field in
  143.      *         IPS_PacketNetHdr below.
  144.      */
  145.     } net;
  146.  
  147.     int            ipLen;        /* Length in bytes of the IP header. */
  148.     Net_IPHeader    *ipPtr;        /* Ptr to the IP header. */
  149.     int            hdrLen;        /* Length in bytes of the higher-level
  150.                      * protocol header. May be 0. */
  151.     union {                /* Ptr. to the HL protocol header. */
  152.     Net_UDPHeader    *udpPtr;
  153.     Net_TCPHeader    *tcpPtr;
  154.     Net_ICMPHeader    *icmpPtr;
  155.     Address        *hdrPtr;
  156.     } hdr;
  157.     int            dataLen;    /* Length in bytes of the data.
  158.                      * May be 0. */
  159.     Address        data;        /* Ptr to the data. */
  160. } IPS_Packet;
  161.  
  162. /*
  163.  * IPS_ROOM_FOR_HEADERS defines how much space might be used by the
  164.  * protocol headers.  This is used to overallocate space so that the
  165.  * packet data may be left in place during packet formatting.
  166.  */
  167. #define IPS_ROOM_FOR_HEADERS    ( (NET_TCP_MAX_HDR_SIZE + \
  168.                    NET_IP_MAX_HDR_SIZE + \
  169.                    sizeof(IPS_PacketNetHdr) + \
  170.                    sizeof(int)) & ~(sizeof(int) - 1) )
  171. /*
  172.  * This type is used by routines when they need to allocate space in an
  173.  * IPS_Packet for the network header in a network-independent way.
  174.  * Usage: sizeof(IPS_PacketNetHdr);
  175.  */
  176.  
  177. typedef union {
  178.     Net_EtherHdr    ether;        /* Ethernet header. */
  179.     /*
  180.      * Headers for other network types go here.
  181.      *   NOTE: If you add a field here, add a corresponding field in
  182.      *         net union in IPS_Packet above.
  183.      */
  184.  
  185. } IPS_PacketNetHdr;
  186.  
  187. /* procedures and variables */
  188.  
  189. extern Boolean        ips_Debug;
  190.  
  191. extern int        IPS_GetTimeStamp();
  192. extern void        IPS_InitPacket();
  193.  
  194. #endif /* _IPS_IPSERVER */
  195. @
  196.  
  197.  
  198. 1.6
  199. log
  200. @Fixed IPS_ROOM_FOR_HEADERS so it is word-aligned.
  201. @
  202. text
  203. @d16 1
  204. a16 1
  205.  * $Header: /sprite/src/daemons/ipServer/RCS/ipServer.h,v 1.5 89/03/23 09:08:24 brent Exp $ SPRITE (Berkeley)
  206. d45 1
  207. a45 1
  208.  * The protocol numbers in netInet.h are not contiguous and too spread 
  209. d60 1
  210. a60 1
  211.  * holds an incoming or outgoing packet. Every packet has an network header, 
  212. d62 1
  213. a62 1
  214.  * For an incoming packet, the headers begin at the base address of the 
  215. d65 1
  216. a65 1
  217.  * header. The routine that allocates an outgoing packet must reserve enough 
  218. d73 1
  219. a73 1
  220.     int            totalLen;    /* Total length (in bytes) of the 
  221. d86 1
  222. a86 1
  223.     /* 
  224. d88 1
  225. a88 1
  226.      *   NOTE: If you add a field here, add a corresponding field in 
  227. d103 1
  228. a103 1
  229.     int            dataLen;    /* Length in bytes of the data. 
  230. d118 2
  231. a119 2
  232.  * This type is used by routines when they need to allocate space in an 
  233.  * IPS_Packet for the network header in a network-independent way. 
  234. d125 1
  235. a125 1
  236.     /* 
  237. d127 1
  238. a127 1
  239.      *   NOTE: If you add a field here, add a corresponding field in 
  240. d140 1
  241. a140 1
  242. #endif _IPS_IPSERVER
  243. @
  244.  
  245.  
  246. 1.5
  247. log
  248. @Added stuff for kernel-resident ipServer.
  249. @
  250. text
  251. @d16 1
  252. a16 1
  253.  * $Header: /sprite/src/daemons/ipServer/RCS/ipServer.h,v 1.4 89/02/21 10:06:07 brent Exp $ SPRITE (Berkeley)
  254. d113 4
  255. a116 3
  256. #define IPS_ROOM_FOR_HEADERS    (NET_TCP_MAX_HDR_SIZE + \
  257.                  NET_IP_MAX_HDR_SIZE + \
  258.                  sizeof(IPS_PacketNetHdr))
  259. @
  260.  
  261.  
  262. 1.4
  263. log
  264. @Added IPS_ROOM_FOR_HEADERS.  This is used to leave room for
  265. the protocol headers in the beginning of the request buffer.
  266. @
  267. text
  268. @d16 1
  269. a16 1
  270.  * $Header: ipServer.h,v 1.3 88/08/26 16:34:59 mendel Exp $ SPRITE (Berkeley)
  271. d26 11
  272. @
  273.  
  274.  
  275. 1.3
  276. log
  277. @Patches for SPUR
  278. @
  279. text
  280. @d16 1
  281. a16 1
  282.  * $Header: ipServer.h,v 1.2 88/08/16 11:16:23 mendel Exp $ SPRITE (Berkeley)
  283. d97 8
  284. @
  285.  
  286.  
  287. 1.2
  288. log
  289. @Converted to use new libc.a
  290. @
  291. text
  292. @d16 1
  293. a16 1
  294.  * $Header: ipServer.h,v 1.1 88/04/27 09:01:18 brent Exp $ SPRITE (Berkeley)
  295. d67 1
  296. @
  297.  
  298.  
  299. 1.1
  300. log
  301. @Initial revision
  302. @
  303. text
  304. @d16 1
  305. a16 1
  306.  * $Header: ipServer.h,v 6.0 87/09/08 15:58:40 andrew Stable $ SPRITE (Berkeley)
  307. d23 2
  308. @
  309.